package cn.edu.neusoft.practice.Controller;

import io.swagger.annotations.Api;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.edu.neusoft.practice.mapper.natpatientMapper;
import cn.edu.neusoft.practice.po.natpatient;



@CrossOrigin
@Api("natpatientController相关的api")
@Controller
public class natpatientController {
	@Autowired
	  private natpatientMapper natpatientMapper;
	  @RequestMapping("/getAllnatpatients")
	  @ResponseBody
	  public List<natpatient> getAllnatpatients(){
	    
	    return natpatientMapper.selectList(null);
	  }
	   @RequestMapping("/updatenatpatient")
	   @ResponseBody
	    public int updatenatpatient(natpatient d){
	      return natpatientMapper.updateById(d);

	    }
	    @RequestMapping("/addnatpatient")
	    @ResponseBody
	    public int addnatpatient(natpatient natpatient){
	      return natpatientMapper.insert(natpatient);
	    }
	
	    @RequestMapping("/deletenatpatient")
	    @ResponseBody
	    public int deletenatpatient(int natid){
	      return natpatientMapper.deleteById(natid);
	    }
	    
	    @RequestMapping("/updatenatpatientPassword")
	    public int updatenatpatientPassword(natpatient natid){
	      return natpatientMapper.updatenatpatientPassword(natid);
	    }
	  
	    
	    
	    
	    
	    public Date getNow()
	     {
	       SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	       Date date = new Date(System.currentTimeMillis());
	       return date;
	     }

	
}
